// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Security;

public sealed partial class ApiKey
{
	/// <summary>
	/// <para>
	/// Creation time for the API key in milliseconds.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("creation")]
	public long? Creation { get; init; }

	/// <summary>
	/// <para>
	/// Expiration time for the API key in milliseconds.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("expiration")]
	public long? Expiration { get; init; }

	/// <summary>
	/// <para>
	/// Id for the API key
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("id")]
	public string Id { get; init; }

	/// <summary>
	/// <para>
	/// Invalidation status for the API key.
	/// If the key has been invalidated, it has a value of <c>true</c>. Otherwise, it is <c>false</c>.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("invalidated")]
	public bool? Invalidated { get; init; }

	/// <summary>
	/// <para>
	/// The owner user’s permissions associated with the API key.
	/// It is a point-in-time snapshot captured at creation and subsequent updates.
	/// An API key’s effective permissions are an intersection of its assigned privileges and the owner user’s permissions.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("limited_by")]
	public IReadOnlyCollection<IReadOnlyDictionary<string, Elastic.Clients.Elasticsearch.Security.RoleDescriptor>>? LimitedBy { get; init; }

	/// <summary>
	/// <para>
	/// Metadata of the API key
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("metadata")]
	public IReadOnlyDictionary<string, object>? Metadata { get; init; }

	/// <summary>
	/// <para>
	/// Name of the API key.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("name")]
	public string Name { get; init; }

	/// <summary>
	/// <para>
	/// The profile uid for the API key owner principal, if requested and if it exists
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("profile_uid")]
	public string? ProfileUid { get; init; }

	/// <summary>
	/// <para>
	/// Realm name of the principal for which this API key was created.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("realm")]
	public string? Realm { get; init; }

	/// <summary>
	/// <para>
	/// Realm type of the principal for which this API key was created
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("realm_type")]
	public string? RealmType { get; init; }

	/// <summary>
	/// <para>
	/// The role descriptors assigned to this API key when it was created or last updated.
	/// An empty role descriptor means the API key inherits the owner user’s permissions.
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("role_descriptors")]
	public IReadOnlyDictionary<string, Elastic.Clients.Elasticsearch.Security.RoleDescriptor>? RoleDescriptors { get; init; }
	[JsonInclude, JsonPropertyName("_sort")]
	public IReadOnlyCollection<Elastic.Clients.Elasticsearch.FieldValue>? Sort { get; init; }

	/// <summary>
	/// <para>
	/// Principal for which this API key was created
	/// </para>
	/// </summary>
	[JsonInclude, JsonPropertyName("username")]
	public string? Username { get; init; }
}